/**
 * Created by uptain on 2017/8/15.
 */
function apiready() {
    const houseId = fxj.getSearch().get('houseId');
    const ja = new Vue({
        el: '#main',
        data: {
            img: '',
            houseId,
            check: false,
            imgRotate: 0,
        },
        methods: {
            toBasic() {
                go('hm_basic.html', {
                    data: {
                        houseId: ja.houseId,
                        papa: 'menu',
                    },
                });
            },
            toIntroduce() {
                go('hm_introduce.html', {
                    data: {
                        houseId: ja.houseId,
                        papa: 'menu',
                    },
                });
            },
            toSetPicture() {
                go('hm_picture.html', {
                    data: {
                        houseId: ja.houseId,
                        papa: 'menu',
                    },
                });
            },
            toSetRule() {
                go('hm_rull.html', {
                    data: {
                        houseId: ja.houseId,
                        papa: 'menu',
                    },
                });
            },
            checkcheck() {
                this.check = !this.check;
            },
            submit() {
                fxj.closeWin();
                closeToWin();
            },

        },
        created() {
            var that = this;
            var temp = new FormData();
            temp.append('houseId', this.houseId);
            $.ajax({
                url: 'http://appv2.fxj178.com/home/houseDetail/getHouseDetail?token=' + localStorage.token,
                type: 'post',
                data: temp,
                datatype: 'JSON',
                processData: false,
                contentType: false,

            }).then(function (result) {
                const re = JSON.parse(result);
                that.img = fxj.fixImgUrl(re.data.img);
                forEach(re.data.imgs, (img) => {
                    if (re.data.img.indexOf(img.surl) !== -1) {
                        ja.imgRotate = (+img.rotate - 1) * 90;
                    }
                });
            });
        },

    });


    var city_data_fliter = function (e) {

        var reurn_data = [];
        var city_data = {
            id: '',
            value: '',
        };
        for (var i = 0; i < CITYS[e].length; i++) {
            city_data = {};
            city_data.id = CITYS[e][i].value;
            city_data.value = CITYS[e][i].text;

            reurn_data.push(city_data);
        }
        return reurn_data;
    };
}



























